﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.SimulationPerformanceRecorder.CUiSimulationPerformanceRecorderWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands.SimulationPerformanceRecorder;

public class CUiSimulationPerformanceRecorderWindow : TxWindow, IComponentConnector
{
  private long m_intervalSamplingForRestore;
  private string m_samplingLogFileLocationForRestore;
  private bool m_performanceActivateforRestore;
  private bool m_processHeapMemoryConsumptionRestore;
  internal CheckBox m_performanceActivate;
  internal TextBox m_samplingLogFileLocation;
  internal TxNumericEditBoxControl m_intervalSampling;
  internal CheckBox m_processHeapMemoryConsumption;
  internal Button btnOK;
  internal Button btnCancel;
  private bool _contentLoaded;

  public CUiSimulationPerformanceRecorderWindow() => this.InitializeComponent();

  private void TxWindow_Loaded(object sender, RoutedEventArgs e)
  {
    this.m_intervalSamplingForRestore = CApSimulationPerformanceRecorderManager.Instance.IntervalSampling;
    this.m_intervalSampling.Value = (double) this.m_intervalSamplingForRestore;
    this.m_samplingLogFileLocationForRestore = CApSimulationPerformanceRecorderManager.Instance.SamplingLogFileLocation;
    this.m_samplingLogFileLocation.Text = this.m_samplingLogFileLocationForRestore;
    this.m_performanceActivateforRestore = CApSimulationPerformanceRecorderManager.Instance.PerformanceActivate;
    this.m_performanceActivate.IsChecked = new bool?(this.m_performanceActivateforRestore);
    this.m_processHeapMemoryConsumptionRestore = CApSimulationPerformanceRecorderManager.Instance.ProcessHeapMemoryConsumption;
    this.m_processHeapMemoryConsumption.IsChecked = new bool?(this.m_processHeapMemoryConsumptionRestore);
  }

  private void btnCancel_Click(object sender, RoutedEventArgs e)
  {
    CApSimulationPerformanceRecorderManager.Instance.IntervalSampling = this.m_intervalSamplingForRestore;
    CApSimulationPerformanceRecorderManager.Instance.SamplingLogFileLocation = this.m_samplingLogFileLocationForRestore;
    CApSimulationPerformanceRecorderManager.Instance.PerformanceActivate = this.m_performanceActivateforRestore;
    CApSimulationPerformanceRecorderManager.Instance.ProcessHeapMemoryConsumption = this.m_processHeapMemoryConsumptionRestore;
    ((Window) this).Close();
  }

  private void btnOK_Click(object sender, RoutedEventArgs e)
  {
    CApSimulationPerformanceRecorderManager.Instance.IntervalSampling = (long) this.m_intervalSampling.Value;
    CApSimulationPerformanceRecorderManager.Instance.SamplingLogFileLocation = this.m_samplingLogFileLocation.Text;
    CApSimulationPerformanceRecorderManager.Instance.PerformanceActivate = this.m_performanceActivate.IsChecked.Value;
    CApSimulationPerformanceRecorderManager.Instance.ProcessHeapMemoryConsumption = this.m_processHeapMemoryConsumption.IsChecked.Value;
    CApSimulationPerformanceRecorderManager.Instance.SetPerformanceRecorderMode();
    ((Window) this).Close();
  }

  private void btnPerformanceActivate_Checked(object sender, RoutedEventArgs e)
  {
  }

  private void btnPerformanceActivate_Unchecked(object sender, RoutedEventArgs e)
  {
  }

  private void btnProcessHeapMemoryConsumption_Checked(object sender, RoutedEventArgs e)
  {
  }

  private void btnProcessHeapMemoryConsumption_Unchecked(object sender, RoutedEventArgs e)
  {
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/simulationperformancerecorder/cuisimulationperformancerecorderwindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        ((FrameworkElement) target).Loaded += new RoutedEventHandler(this.TxWindow_Loaded);
        break;
      case 2:
        this.m_performanceActivate = (CheckBox) target;
        this.m_performanceActivate.Checked += new RoutedEventHandler(this.btnPerformanceActivate_Checked);
        this.m_performanceActivate.Unchecked += new RoutedEventHandler(this.btnPerformanceActivate_Unchecked);
        break;
      case 3:
        this.m_samplingLogFileLocation = (TextBox) target;
        break;
      case 4:
        this.m_intervalSampling = (TxNumericEditBoxControl) target;
        break;
      case 5:
        this.m_processHeapMemoryConsumption = (CheckBox) target;
        this.m_processHeapMemoryConsumption.Checked += new RoutedEventHandler(this.btnProcessHeapMemoryConsumption_Checked);
        this.m_processHeapMemoryConsumption.Unchecked += new RoutedEventHandler(this.btnProcessHeapMemoryConsumption_Unchecked);
        break;
      case 6:
        this.btnOK = (Button) target;
        this.btnOK.Click += new RoutedEventHandler(this.btnOK_Click);
        break;
      case 7:
        this.btnCancel = (Button) target;
        this.btnCancel.Click += new RoutedEventHandler(this.btnCancel_Click);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }
}
